# 基础镜像
FROM ubuntu:22.04

# build参数
ARG user=postman
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Asia/Shanghai

# 安装依赖
RUN apt-get update \
    && apt-get install -y \
    libxcb-keysyms1-dev \
    libxcb-image0-dev \
    libxcb-shm0-dev \
    libxcb-icccm4-dev \
    libxcb-sync0-dev \
    libxcb-xfixes0-dev \
    libxcb-shape0-dev \
    libxcb-randr0-dev \
    libxcb-render-util0-dev \
    libfontconfig1-dev \
    libfreetype6-dev \
    libx11-dev \
    libxext-dev \
    libxfixes-dev \
    libxi-dev \
    libxrender-dev \
    libxcb1-dev \
    libx11-xcb-dev \
    libxcb-glx0-dev \
    x11vnc \
    xauth \
    build-essential \
    mesa-common-dev \
    libglu1-mesa-dev \
    libxkbcommon-dev \
    libxcb-xkb-dev \
    libxslt1-dev \
    libgstreamer-plugins-base1.0-dev \
    libxkbcommon-x11-0 \
    libgtk-3-0 \
    libnotify4 \
    libnss3 \
    xdg-utils \
    libatspi2.0-0 \
    libsecret-1-0 \
    adwaita-icon-theme \
    hicolor-icon-theme \
    libatk-bridge2.0-0 \
    libatk1.0-0 \
    libcairo-gobject2 \
    libcolord2 \
    libcups2 \
    libepoxy0 \
    libfribidi0 \
    libgdk-pixbuf-2.0-0 \
    libharfbuzz0b \
    libpango-1.0-0 \
    libpangocairo-1.0-0 \
    libpangoft2-1.0-0 \
    libxcursor1 \
    libgtk-3-common \
    libgtk-3-bin \
    librsvg2-common \
    gtk-update-icon-cache \
    ubuntu-mono \
    libatk1.0-data \
    liblcms2-2 \
    libgdk-pixbuf2.0-common \
    libgdk-pixbuf2.0-bin \
    gtk-update-icon-cache \
    dconf-gsettings-backend \
    libgraphite2-3 \
    libnspr4 \
    fontconfig \
    libthai0 \
    librsvg2-2 \
    libsecret-common \
    dconf-service \
    libdconf1 \
    libthai-data \
    libdatrie1 \
    humanity-icon-theme \
    dbus-x11 \
    dbus-user-session \
    libpam-systemd \
    systemd \
    systemd-sysv \
    libcryptsetup12 \
    libip4tc2 \
    libkmod2 \
    libsystemd0 \
    networkd-dispatcher \
    systemd-timesyncd \
    libargon2-1 \
    libdevmapper1.02.1 \
    libjson-c5 \
    python3-dbus \
    python3-gi \
    lib32z1 \
    libasound2 \
    gcc \
    autoconf \
    make \
    automake \
    sudo \
    aria2

# 添加用户：赋予sudo权限，指定密码
RUN useradd --create-home --no-log-init --shell /bin/bash ${user} \
    && adduser ${user} sudo \
    && echo "${user}:123456" | chpasswd

# 从构建上下文目录中的文件复制到新的一层的镜像内的位置
RUN aria2c -c "https://dl.pstmn.io/download/latest/linux_64" -o /tmp/postman/postman-linux-x64.tar.gz
RUN tar xvzf /tmp/postman/postman-linux-x64.tar.gz  -C /usr/lib/
RUN ln -s /usr/lib/Postman/Postman /usr/bin/
RUN rm -rf /tmp/postman/*

# 指定工作目录
WORKDIR /home/${user}

# 指定登录用户
USER ${user}

# 指定docker run时执行的程序
ENTRYPOINT Postman
